| Conditions | 2 |
| Total Lines | 13 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | export interface DisplayState { |
||
| 38 | |||
| 39 | export function shouldBoxBeDisabled(index: number, boxes: boolean[]): boolean { |
||
| 40 | const is2048Active = boxes[0]; |
||
| 41 | const isCurrentBoxActive = boxes[index]; |
||
| 42 | |||
| 43 | // Box 0 (2048) is disabled if any other box is active and 2048 is not active |
||
| 44 | if (index === 0) { |
||
| 45 | const isAnyOtherBoxActive = boxes.slice(1).some(box => box); |
||
| 46 | return isAnyOtherBoxActive && !is2048Active; |
||
| 47 | } |
||
| 48 | |||
| 49 | // Other boxes are disabled if 2048 is active and the current box is not active |
||
| 50 | return is2048Active && !isCurrentBoxActive; |
||
| 51 | } |
||
| 52 |